﻿#ifndef _OI_PLSCANNERCORE_TOOLPROFILESVIEW_HPP_
#define _OI_PLSCANNERCORE_TOOLPROFILESVIEW_HPP_

#include "PLScannerCore/OiPLScannerCore.hpp"

namespace Oi
{
    namespace PLScannerCore
    {
        class ProductParams;

        class OI_PLSCANNER_CORE_API ToolProfilesView : public QGraphicsView
        {
            Q_OBJECT

        public:
            ToolProfilesView(QWidget * parent = nullptr);

            void setPageFlag(ProductMeasurePage flag);

            void setParams(const ProductParams& params);

            void setTemplate(const OiProfiles& profiles);

            void setProfiles(const OiProfiles& profiles);

            void setValues(const OiResultData& data);

            void setResult(const WorkResult::Result& result);

            void addMeasureTool();

            void setEditable(bool enable);

            QPointF setMeasureToolPos(int i, double x);

            QPointF setFixedMeasurePos(double x);

        public slots:
            void zoomFit();
        
        signals:
            void toolDoubleClicked(const int id, const int type);
            void addToolComplete(const QPointF p);
            void delTool(const int id);
        public slots:
            void onClearView();

        public:
            void mousePressEvent(QMouseEvent *event);
            void mouseReleaseEvent(QMouseEvent *event);
            void mouseMoveEvent(QMouseEvent *event);
            void mouseDoubleClickEvent(QMouseEvent *event);
            void wheelEvent(QWheelEvent *event);
            void drawForeground(QPainter *painter, const QRectF &rect);
            void contextMenuEvent(QContextMenuEvent *event);
            void enterEvent(QEvent *event);
            void leaveEvent(QEvent *event);

        private:
            OI_DECLARE_IMPL(ToolProfilesView);
            OI_DISABLE_COPY(ToolProfilesView);
        };
    }
}


#endif
